package com.mccraywebtech.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.mccraywebtech.dao.GenericDAO;
import com.mccraywebtech.models.Contact;

@Repository("contactMockDAO")
public class ContactMockDAOImpl implements GenericDAO<Contact> {
	private List<Contact> contacts = new ArrayList<Contact>();
	private int count = 0;

	@Override
	public void saveObject(Contact c) {
		c.setId(count);
		count++;
		contacts.add(c.getId(), c);
	}

	@Override
	public void updateObject(Contact c) {
		contacts.add(c.getId(), c);
	}

	@Override
	public void deleteObject(int id) {
		contacts.remove(id);
	}

	@Override
	public Contact getObject(int id) {
		return contacts.get(id);
	}

	@Override
	public List<Contact> getAllObjects() {
		System.out.println("In Mock Data...");
		return contacts;
	}

	@Override
	public Contact getByUsername(String username) {
		// TODO Auto-generated method stub
		return null;
	}

}
